package com.example.extenddemo.handle;

import com.fasterxml.jackson.core.JacksonException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * @ClassName CustomJsonDeserializer 自定义的反序列化处理器   可用AES解密和其他加密方法的解密
 * @Description TODO
 * @Author 郭敖
 * @Date 2024年07月05日 22:53
 * @Version 1.0
 */
public class CustomJsonDeserializer extends JsonDeserializer<String> {
    private final Logger log = LoggerFactory.getLogger(CustomJsonDeserializer.class);
    @Override
    public String deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JacksonException {
        // 获取json文本
        String text = jsonParser.getText();
        log.warn("jsonText{}", text);
        return String.format("userName:%s", text);
    }
}
